home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 8: LINUX Games
/
Linux Cubed Series 8 - LINUX Games.iso
/
games
/
strategy
/
vga_card.000
/
vga_cardgames-1.3.1.tar
/
vga_cardgames
/
key.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-02-26
|
825b
|
43 lines
/*
* Keyboard handling
*
* Copyright (C) Evan Harris, 1994, 1995.
*
* Permission is granted to freely redistribute and modify this code,
* providing the author(s) get credit for having written it.
*/
#include <vga.h>
#include "key.h"
/*
* We probably should use the svgalib keyboard_() functions, but the warnings
* scared me. 8-)
*/
int
key_getkey()
{
int key;
if ((key = vga_getkey()) != 0x1b) {
return key; /* not ESC */
}
if ((key = vga_getkey()) != '[') {
return 0x1b; /* it was ESC */
}
switch (key = vga_getkey()) {
case 'A':
return KEY_CURSORUP; /* up */
case 'B':
return KEY_CURSORDOWN; /* down */
case 'C':
return KEY_CURSORRIGHT; /* right */
case 'D':
return KEY_CURSORLEFT; /* left */
default:
return -1; /* ignore */
break;
}
}